<template>
  <div>
    <!-- <el-input v-model="input" placeholder="请输入内容"></el-input>
    <el-button type="primary" disabled @click="find">主要按钮</el-button>-->
    <el-table :data="ordersList" style="width: 100%">
      <el-table-column fixed prop="id" label="主键id" width="80"></el-table-column>
      <el-table-column prop="user_identity_id" label="发布员学号/工号" width="100"></el-table-column>
      <el-table-column prop="orderNum" label="订单编号" width="100"></el-table-column>
      <el-table-column prop="remark" label="备注" width="100"></el-table-column>
      <el-table-column prop="order_status" label="订单状态" width="150"></el-table-column>

      <el-table-column prop="orderType_price" label="订单价格" width="80"></el-table-column>
      <el-table-column prop="user_name" label="用户名" width="100"></el-table-column>
      <el-table-column prop="phone" label="联系方式" width="100"></el-table-column>
      <el-table-column prop="sender_id" label="接单员学号/工号" width="100"></el-table-column>
      <el-table-column prop="order_time" label="下单时间" width="100"></el-table-column>
      <el-table-column prop="end_time" label="订单完成时间" width="100"></el-table-column>
      <el-table-column prop="sign_time" label="订单失效时间" width="100"></el-table-column>
      <el-table-column prop="pick_code" label="取件码" width="100"></el-table-column>
      <el-table-column prop="expressWeightType" label="订单重量类型" width="100"></el-table-column>
      <el-table-column prop="expressCompanyType" label="取件地址" width="100"></el-table-column>
      <el-table-column prop="serviceAddress" label="送达地址" width="100"></el-table-column>
      <el-table-column prop="middle_address" label="快递进度" width="100"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit( scope.row)">编辑</el-button>
          <el-button size="mini" type="danger" @click="handleDelete( scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  methods: {
    find() {},
    handleEdit(row) {
      this.$router.push({
        path: "/updateOrder",
        query: {
          id: row.id
        }
      });
    },
    handleDelete(row) {
      const _this = this;
      //  axios({
      //             method:"put",
      //             url:"http://39.99.160.25:8088/notices/web/delete_order",
      //             data:{},
      //             headers:
      //             {
      //               // "Authorization":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ7XCJpZFwiOjksXCJ1c2VybmFtZVwiOm51bGwsXCJwaG9uZVwiOm51bGwsXCJhZGRyZXNzXCI6bnVsbCxcInJlbWFya1wiOm51bGwsXCJhdXRob3JpdHlcIjowLFwicGFzc3dvcmRcIjpcIjExMTExMVwiLFwiaGVhZF9wb3J0cmFpdFwiOm51bGwsXCJhcHBpZFwiOm51bGwsXCJzY29wZVwiOm51bGwsXCJzdGF0ZVwiOm51bGwsXCJ3aGV0aGVyX2RlbGV0ZVwiOm51bGwsXCJpZGVudGl0eV9pZFwiOlwiMTExMTExXCIsXCJjcmVhdGVfdGltZVwiOm51bGwsXCJ1cGRhdGVfdGltZVwiOm51bGwsXCJkZWxldGVfdGltZVwiOm51bGwsXCJvcmRlcnNMaXN0XCI6bnVsbH0iLCJleHAiOjE2MDUwOTU5OTZ9.TBEM_7Ti_Mm_UB9vD236lPstsqMjWAawBaBDFSp6oN0"
      //             'Authorization':sessionStorage.getItem('token'),
      //             }

      //         }).then(function (resp){
      //           if(resp.data.data.msg=='修改成功'){
      //               _this.$alert('《'+row.id+'》删除成功！', '消息',{
      //                 confirmButtonText: '确定',
      //                  callback: action =>{
      //                     _this.$router.push('/orders')
      //                  }
      //               })
      //           }
      //         });
    }
  },
  data() {
    return {
      ordersList: [
        {
          id: "1",
          user_identity_id: "111",
          orderNum: "111",
          remark: "111",
          order_status: "111",
          orderType_price: "222",
          user_name: "111",
          phone: "111",
          sender_id: "111",
          order_time: "111",
          end_time: "111",
          sign_time: "111",
          pick_code: "111",
          expressWeightType: "111",
          expressCompanyType: "111",
          serviceAddress: "111",
          middle_address: "111"
        },
        {
          id: "2",
          user_identity_id: "222",
          orderNum: "222",
          remark: "222",
          order_status: "222",
          orderType_price: "222",
          user_name: "222",
          phone: "222",
          sender_id: "222",
          order_time: "222",
          end_time: "222",
          sign_time: "222",
          pick_code: "222",
          expressWeightType: "222",
          expressCompanyType: "222",
          serviceAddress: "222",
          middle_address: "222"
        },
        {
          id: "3",
          user_identity_id: "333",
          orderNum: "333",
          remark: "333",
          order_status: "333",
          orderType_price: "333",
          user_name: "333",
          phone: "333",
          sender_id: "333",
          order_time: "333",
          end_time: "333",
          sign_time: "333",
          pick_code: "333",
          expressWeightType: "333",
          expressCompanyType: "333",
          serviceAddress: "333",
          middle_address: "333"
        },
        {
          id: "4",
          user_identity_id: "444",
          orderNum: "444",
          remark: "444",
          order_status: "444",
          orderType_price: "444",
          user_name: "444",
          phone: "444",
          sender_id: "444",
          order_time: "444",
          end_time: "444",
          sign_time: "444",
          pick_code: "444",
          expressWeightType: "444",
          expressCompanyType: "444",
          serviceAddress: "444",
          middle_address: "444"
        },
        {
          id: "5",
          user_identity_id: "555",
          orderNum: "555",
          remark: "555",
          order_status: "555",
          orderType_price: "55",
          user_name: "555",
          phone: "555",
          sender_id: "555",
          order_time: "555",
          end_time: "555",
          sign_time: "555",
          pick_code: "555",
          expressWeightType: "555",
          expressCompanyType: "555",
          serviceAddress: "555",
          middle_address: "555"
        }
      ]
    };
  },
  created() {
    const _this = this;
    axios({
      method: "get",
      url: "http://localhost:8088/orders/wx/selectAllOrders",
      data: {},
      headers: {
        // "Authorization":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ7XCJpZFwiOjksXCJ1c2VybmFtZVwiOm51bGwsXCJwaG9uZVwiOm51bGwsXCJhZGRyZXNzXCI6bnVsbCxcInJlbWFya1wiOm51bGwsXCJhdXRob3JpdHlcIjowLFwicGFzc3dvcmRcIjpcIjExMTExMVwiLFwiaGVhZF9wb3J0cmFpdFwiOm51bGwsXCJhcHBpZFwiOm51bGwsXCJzY29wZVwiOm51bGwsXCJzdGF0ZVwiOm51bGwsXCJ3aGV0aGVyX2RlbGV0ZVwiOm51bGwsXCJpZGVudGl0eV9pZFwiOlwiMTExMTExXCIsXCJjcmVhdGVfdGltZVwiOm51bGwsXCJ1cGRhdGVfdGltZVwiOm51bGwsXCJkZWxldGVfdGltZVwiOm51bGwsXCJvcmRlcnNMaXN0XCI6bnVsbH0iLCJleHAiOjE2MDUwOTAxNTN9.VYI1_w6X8puL7gI1Wx4O78LMc56WxJgAaNwiBsYysUg"
        Authorization: sessionStorage.getItem("token")
      }
    }).then(function(resp) {
      console.log(resp);

      _this.ordersList = resp.data.data.orders;
    });
  }
};
</script>